#pragma once

#include "Ability/EditorAbilityViewModel.h"
#include "EditorCallStackAbilityModel.h"
#include "EditorCallStackAbilityViewModel.m.h"

class REditorCallStackAbilityModel;

RCLASS()
class REditorCallStackAbilityViewModel : public REditorAbilityViewModel
{
    ROBJECT

public:
    void BindModel(TSharedObjectPtr<REditorAbilityModel> InModel) override;
    virtual TSharedObjectPtr<RTexture2D> GetIcon() const override;
    virtual TSharedObjectPtr<RTexture2D> GetHighlightIcon() const override;

protected:
    TWeakObjectPtr<REditorCallStackAbilityModel> CallStackModel;
    TSharedObjectPtr<RTexture2D> Icon;
    TSharedObjectPtr<RTexture2D> HighlightIcon;


public:

    int64_t GetCallStackFrameNum() const;
    CString GetCallStackFrameFunctionName(int64_t InIndex) const;
    CString GetCallStackFrameFileName(int64_t InIndex) const;
    int64_t GetCallStackFrameLineNumber(int64_t InIndex) const;

    TDelegate<void> OnCallStackChanged;

    void HoverFrame(int64_t InIndex);
    void UnhoverFrame(int64_t InIndex);
    bool IsFrameHovered(int64_t InIndex) const;

    void OnFrameClicked(int64_t InIndex);
    bool IsFrameSelected(int64_t InIndex) const;
protected:
    int64_t HoveredFrameIndex = -1;

};